load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
    name = "protobuf-lite",
    srcs = glob([
        "src/main/java/**/*.java",
    ]),
    visibility = ["//visibility:public"],
    deps = [
        "//api",
        artifact("com.google.code.findbugs:jsr305"),
        artifact("com.google.guava:guava"),
        artifact("com.google.j2objc:j2objc-annotations"),
    ] + select({
        ":android": [artifact("com.google.protobuf:protobuf-javalite")],
        "//conditions:default": [artifact("com.google.protobuf:protobuf-java")],
    }),
)

# This config is not fully-reliable. If it breaks, it is probably because you
# are changing --android_crosstool_top. Instead of doing that, you can bind
# your own toolchain on top of the default android/crosstool, as mentioned at
# https://github.com/bazelbuild/bazel/issues/3924#issuecomment-338704582
config_setting(
    name = "android",
    values = {
        "crosstool_top": "//external:android/crosstool",
    },
)
